package net.zjitc.dao;

import net.zjitc.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface UserDao {
    @Insert("insert into users (username,age) values (#{username},#{age})")
    void save(User user);
    @Delete("delete from users where id = #{id}")
    void delete(int id);
    @Update("update users set username=#{username},age=#{age} where id=#{id}")
    void update(User user);
    @Select("select * from users")
    List<User> findAll();
    @Select("select * from users where id=#{id}")
    User findById(int id);
}
